home *** CD-ROM | disk | FTP | other *** search
/ PCNet 1998 May / PCnet Mayıs 1998.iso / Internet / Browsers / amaya-Windows95-1.2.ZIP / thot / amaya / MathML.trans < prev    next >
Encoding:
Text File  |  1998-01-27  |  4.8 KB  |  283 lines

  1. ! file MathML.trans : structure transformation for MathML
  2. ! see HTML.trans for a description of Trans language
  3. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4.  
  5. ! WARNING : transformations does NOT work with Multiscript elements
  6. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  7.  
  8. !!! mrow transformation
  9.  
  10. !surround an element with a mrow
  11. surrounding row: *;
  12.         {
  13.         * > MROW:*;
  14.         }
  15.  
  16.  
  17. !surround a sequence of elements with a mrow
  18. surrounding row: *,*+;
  19.         {
  20.         * > MROW:*;
  21.         }
  22.  
  23. ! remove a mrow level
  24. remove row: MROW{*+};
  25.         {
  26.         * > :*;
  27.         }
  28.  
  29. !!! Root Transformations
  30.  
  31. !surround an element with a root
  32. surrounding root : *;
  33.     {
  34.     * > MROOT:*;
  35.     * > MROOT:NONE % ;
  36.     }
  37.  
  38. !surround a sequence of elements with a root
  39. surrounding root: *+,last:*;
  40.         {
  41.         * > MROOT.MROW:*;
  42.     last > MROOT.MROW:*;
  43.     last > MROOT:NONE % ;
  44.         }
  45.  
  46. !remove a root
  47. remove root: MROOT{base:*,? index:*};
  48.         {
  49.         base > :*;
  50.     index / ;
  51.         }
  52.  
  53.  
  54. !!! Square Root Transformations
  55.  
  56. !surround an element with a square root
  57. surrounding square root: *;
  58.         {
  59.         * > MSQRT:*;
  60.         }
  61.  
  62.  
  63. !surround a sequence of elements with a square root
  64. surrounding square root: *,*+;
  65.         {
  66.         * > MSQRT.MROW:*;
  67.         }
  68.  
  69. !remove a square root
  70. remove square root: MSQRT{*};
  71.         {
  72.         * > :*;
  73.         }
  74.  
  75. !transform a square root into a root
  76. root with index: MSQRT{*};
  77.     {
  78.     * > MROOT:*;
  79.     * > MROOT:NONE %;
  80.     }
  81.  
  82. !!! Fraction transformations
  83.  
  84. !transform 2 elements into a fraction
  85. fraction: (num:*,den:*) | MROW{num:*,den:*};
  86.         {
  87.         num > MFRAC:*;
  88.         den > MFRAC:*;
  89.         }
  90.  
  91. !transform an  element into a numerator
  92. numerator: *;
  93.         {
  94.         * > MFRAC:*;
  95.         * > MFRAC:NONE %;
  96.         }
  97.  
  98. !transform an sequence of elements into a numerator
  99. numerator: ?*+,last:*;
  100.         {
  101.         * > MFRAC.MROW:*;
  102.     last > MFRAC.MROW:*;
  103.         last > MFRAC:NONE %;
  104.         }
  105.  
  106. !transform an element into a denominator
  107. denominator: *;
  108.         {
  109.         * > MFRAC:NONE %;
  110.         * > MFRAC:*;
  111.         }
  112.  
  113. !transform an sequence of elements into a denominator
  114. denominator: first:*,?*+;
  115.         {
  116.         first > MFRAC:NONE %;
  117.     first > MFRAC.MROW:*;
  118.         * > MFRAC.MROW:*;
  119.         }
  120.  
  121. !remove a fraction
  122. remove fraction: MFRAC{?(num:*),?(den:*)};
  123.         {
  124.         num > :*;
  125.         den > :*;
  126.         }
  127.  
  128.  
  129. !!! Sub and Sup Transformations
  130.  
  131. !surroud an element with a subsup
  132. add sub and sup:*;
  133.     {
  134.     * > MSUBSUP:*;
  135.     * > MSUBSUP:NONE%;
  136.     * > MSUBSUP:NONE;
  137.     }
  138.  
  139. !removes a subsup
  140. remove subsup: MSUBSUP{base:*,?sub:*,?sup:*};
  141.     {
  142.     base > :*;
  143.     sub /;
  144.     sup /;
  145.     }
  146.  
  147. !removes a superscript
  148. remove superscript: MSUBSUP{base:*,?sub:*,?sup:*};
  149.     {
  150.     MSUBSUP > MSUB;
  151.     sup /;
  152.     }
  153.  
  154. !removes a subscript
  155. remove subscript: MSUBSUP{base:*,?sub:*,?sup:*};
  156.     {
  157.     MSUBSUP > MSUP;
  158.     sub /;
  159.     }
  160.  
  161. !surroud element with a sub
  162. add subscript:*;
  163.     {
  164.     * > MSUB:*;
  165.     * > MSUB:NONE %;
  166.     }
  167.  
  168. !removes a subscript
  169. remove subscript: MSUB{base:*,?sub:*};
  170.     {
  171.     base > :*;
  172.     sub /;
  173.     }
  174.  
  175. !surroud an element with a sup
  176. add superscript:*;
  177.     {
  178.     * > MSUP:*;
  179.     * > MSUP:NONE %;
  180.     }
  181.  
  182. !removes a superscript
  183. remove superscript: MSUP{base:*,?sup:*};
  184.     {
  185.     base > :*;
  186.     sup /;
  187.     }
  188.  
  189. !change MSUB into MSUP
  190. superscript:MSUB;
  191.     {
  192.     MSUB > MSUP;
  193.     }
  194.  
  195. !change MSUP into MSUB
  196. subscript:MSUP;
  197.     {
  198.     MSUP > MSUB;
  199.     }
  200.  
  201. !change MSUB or MSUP into MSUBSUP
  202. subsup:MSUB{base:*,sub:*} | MSUP{base:*,sup:*};
  203.     {
  204.     base > MSUBSUP:*;
  205.     sup > MSUBSUP:NONE %;
  206.     sup > MSUBSUP:*;
  207.     sub > MSUBSUP:*;
  208.     sub > MSUBSUP:NONE %;
  209.     }
  210.  
  211. !!! Under and Over transformations
  212.  
  213. !surroud an element with a underover
  214. add under and over:*;
  215.     {
  216.     * > MUNDEROVER:*;
  217.     * > MUNDEROVER:NONE %;
  218.     * > MUNDEROVER:NONE;
  219.     }
  220.  
  221. ! remove an underover
  222. remove under and over:MUNDEROVER{base:*,?under:*,?over:*};
  223.     {
  224.     base > :*;
  225.     under /;
  226.     over /;
  227.     }
  228.  
  229. !surroud an element with a over
  230. add over:*;
  231.     {
  232.     * > MOVER:*;
  233.     * > MOVER:NONE %;
  234.     }
  235.  
  236. ! remove an over
  237. remove under and over:MOVER{base:*,?over:*};
  238.     {
  239.     base > :*;
  240.     over /;
  241.     }
  242.  
  243. !surroud an element with a under
  244. add under:*;
  245.     {
  246.     * > MUNDER:*;
  247.     * > MUNDER:NONE;
  248.     }
  249.  
  250. ! remove an under
  251. remove under:MUNDER{base:*,?under:*};
  252.     {
  253.     base > :*;
  254.     under /;
  255.     }
  256.  
  257. !!! Parenthesis Transformations
  258.  
  259. !surround an element with parentheses
  260. parenthesize:*;
  261.         {
  262.         * > MROW:MO."(";
  263.         * > MROW:*;
  264.         * > MROW:MO.")";
  265.         }
  266.  
  267. !surround a sequence of elements with parentheses
  268. parenthesize: first:*,?*+, last:* ;
  269.         {
  270.         first > MROW:MO."(";
  271.         first > MROW:*;
  272.         * > MROW:*;
  273.         last > MROW:*;
  274.         last > MROW:MO.")";
  275.         }
  276.  
  277. !remove parenthesis
  278. remove parenthesis: MROW{MO,?*+,MO};
  279.     {
  280.     MO /;
  281.     * > :*;
  282.     }
  283.